//! \file Sequence_TODO.h
//! \brief Defines the <code>fullsail_ai::fundamentals::Sequence</code> class.
//! \author Jeremiah Blanchard

#include <queue>
#include <stack>
#include "Sequence.h"

namespace fullsail_ai { namespace fundamentals {

	Sequence::Sequence(char const* _description) : Behavior(_description)
	{
	}

	bool Sequence::run( void (*dataFunction)(Behavior const*), Agent* agent )
	{
		if(getChildCount() != 0)
		{
			bool testb = true;
			for(int i = 0; i < getChildCount();i++)
			{
				if(!getChild(i)->run(dataFunction,agent))
				{
					testb = false;
					break;
				}

			}
			if(testb)
			{
				dataFunction(this);
				return true;
			}
		}
		return false;
	}


}}  // namespace fullsail_ai::fundamentals
